<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('网络媒体资料列表')"/>
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>媒体名称：</label>
                            <input type="text" name="mediaName"/>
                        </li>
                        <li>
                            <label>平台：</label>
                            <select class="form-control" name="platform" th:with="type=${@dict.getType('work_platform')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>分类：</label>
                            <select class="form-control" name="category" th:with="type=${@dict.getType('work_category')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <label>联系人：</label>
                            <input type="text" name="contacts"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="work:net:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="work:net:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="work:net:import">
                <i class="fa fa-upload"></i> 导入
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="work:net:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="work:net:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('work:net:edit')}]];
    var removeFlag = [[${@permission.hasPermi('work:net:remove')}]];
    var platformDatas = [[${@dict.getType('work_platform')}]];
    var categoryDatas = [[${@dict.getType('work_category')}]];
    var industryDatas = [[${@dict.getType('work_industry')}]];
    var includedDatas = [[${@dict.getType('work_included')}]];
    var linkDatas = [[${@dict.getType('work_publish_link')}]];
    var weekendPressDatas = [[${@dict.getType('work_publish_paper')}]];
    var publishDatas = [[${@dict.getType('work_publish_date')}]];
    var prefix = ctx + "work/net";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            importTemplateUrl: prefix + "/importTemplate",
            importUrl: prefix + "/importData",
            modalName: "网络媒体资料",
            columns: [{
                checkbox: true
            },
                {
                    field: 'mediaId',
                    title: '媒体ID',
                    width:80
                },
                {
                    field: 'mediaName',
                    title: '媒体名称',
                    width:150
                },
                {
                    field: 'platform',
                    title: '平台',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(platformDatas, value);
                    }
                },
                {
                    field: 'province',
                    title: '省份',
                    width:100
                },
                {
                    field: 'city',
                    title: '地市',
                    width:100
                },
                {
                    field: 'category',
                    title: '分类',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(categoryDatas, value);
                    },
                    width:100
                },
                {
                    field: 'industry',
                    title: '行业',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(industryDatas, value);
                    },
                    width:100
                },
                {
                    field: 'included',
                    title: '收录',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(includedDatas, value);
                    },
                    width:100
                },
                {
                    field: 'price',
                    title: '价格',
                    width:100
                },
                {
                    field: 'link',
                    title: '发布链接',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(linkDatas, value);
                    },
                    width:170
                },
                {
                    field: 'weekendPress',
                    title: '周末发稿',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(weekendPressDatas, value);
                    },
                    width:170
                },
                {
                    field: 'mediaCase',
                    title: '案例',
                    width:250
                },
                {
                    field: 'publish',
                    title: '出稿日期',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(publishDatas, value);
                    },
                    width:120
                },
                {
                    field: 'contacts',
                    title: '联系人',
                    width:100
                },
                {
                    field: 'remark',
                    title: '备注',
                    width:250
                }]
        };
        $.table.init(options);
    });
</script>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <!--<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</body>
</html>